Ext.define('ES.view.components.CompThumb',{
	extend:'Ext.container.Container',
	requires:['ES.view.components.RatingComp'],
	alias:'widget.compthumb',
	layout:{
		type:'hbox',
		align:'left',
		defaultMargins:{top: 0, right: 20, bottom: 0, left: 0}
	},
	width:'100%',
	config:{
		pic:'',
		title:'',
		rating:3,
		overview:'',
		version:0,
		compId:0,
		comments:[],
		envSupport:[],
		langSupport:[]
	},
	initComponent:function(){
		var me = this;
		this.items=[
			{
				xtype:'image',
				src:this.pic,
				width:100,
				height:100,
				padding:'5 5 5 5'
			},
			{
				xtype:'container',
				layout:{
					type:'vbox',
					defaultMargins:{top: 0, right: 0, bottom: 5, left: 0}
				},
				width:'100%',
				items:[
					{
						xtype:'container',
						html:this.title,
						style:{
							fontSize:15,
							color:'#6DB8E0',
							fontWeight:'bold',
							cursor:'hand'
						},
						listeners: {
					        click: {
					            element: 'el',
					            fn: function(){
					            	me.addEvents('OPEN_COMP_DETAIL_PAGE_EVENT');
					            	me.fireEvent('OPEN_COMP_DETAIL_PAGE_EVENT',me.title,me.pic,me.rating,me.overview, me.compId,me.comments, me.envSupport, me.langSupport, me.version)
					            }
					        }
					    }
					},
					{
						xtype:'container',
						layout:'vbox',
						items:[
							{
								xtype:'container',
								html:'ratings'
							},
							{
								xtype:'ratingcomp',
								rating:this.rating
							}
						]
					},
					{
						xtype:'container',
						html:this.overview
					},
					{
						xtype:'container',
						html:'view detail >>',
						style:{
							color:'#6DB8E0',
							cursor:'hand'						
						},
						listeners: {
					        click: {
					            element: 'el',
					            fn: function(){
					            	me.addEvents('OPEN_COMP_DETAIL_PAGE_EVENT');
					            	me.fireEvent('OPEN_COMP_DETAIL_PAGE_EVENT',me.title,me.pic,me.rating,me.overview, me.compId,me.comments,me.envSupport, me.langSupport,me.version)
					            }
					        }
					    }
					}
				]
			}
		]
		this.callParent(arguments);
	}
});
